import { gql } from '@apollo/client';
import {
	TASK_CATEGORY_KEYS,
	JOB_TASK_TYPES,
} from '../../../../common/constants';

export default gql`
	fragment JobFields on Job {
		_id
		note
		assetId
		inTaskQueue
		targetUrl
		sourceIp
		target {
			protocol
			host
			hostname
			domain: eTLD1
		}
		verification {
			isVerified
			challenge
		}
		enableMonitor
		enableAlert
		ignoredWarnIdMap
		vulAbnormal
    sslAbnormal
    httpAbnormal
    pingAbnormal
		categoryStatus {
			${TASK_CATEGORY_KEYS.map(
				category => `
					${category} {
						enable
						status
						updateTime
						warningCount
						warningDetails
					}
				`
			)}
		}
		${JOB_TASK_TYPES.map(
			type => `
				${type}Settings {
					enable
					target
				}
			`
		).join('\n')}
	}
`;
